package com.pse.crawler;

import java.util.ArrayList;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.pse.service.CrawlerService;

import us.codecraft.webmagic.ResultItems;
import us.codecraft.webmagic.Task;
import us.codecraft.webmagic.pipeline.Pipeline;

@Component
public class Cpipe implements Pipeline{

	@Autowired
	private CrawlerService cservice;
	
	@Override
	public void process(ResultItems aresult, Task task) {
		ArrayList<Integer> abc = aresult.get("repo");
		int a;
		for(int i=0;i<21;i++){
			a = abc.get(i);
			cservice.update(i+1, a);
		}
	}

}
